package com.nf28.removies.viewtimeline;

import java.text.SimpleDateFormat;
import java.util.Date;

public class Scale {
	public static enum TimeScale {YEAR,MONTH,DAY,HOUR};
	
	public static TimeScale next(TimeScale curent){
		switch(curent){
		case YEAR:
			return TimeScale.MONTH;
		case MONTH:
			return TimeScale.DAY;
		case DAY:
			return TimeScale.HOUR;
		case HOUR:
			return TimeScale.HOUR;
		}
		return curent;
	}
	
	public static TimeScale prev(TimeScale curent){
		switch(curent){
		case YEAR:
			return TimeScale.YEAR;
		case MONTH:
			return TimeScale.YEAR;
		case DAY:
			return TimeScale.MONTH;
		case HOUR:
			return TimeScale.DAY;
		}
		return curent;
	}
	
	public static String setDateScale(Date curent,TimeScale scale){
		if(curent == null) return "****";
		switch(scale){
		case YEAR:
			return("----");
		case MONTH:
			return(new SimpleDateFormat("yyyy").format(curent));
		case DAY:
			return(new SimpleDateFormat("MM/yyyy").format(curent));
		case HOUR:
			return(new SimpleDateFormat("dd/MM/yyyy").format(curent));
		default:
			return(":(");
		}
	}

}
